package com.myway.dto.order;

import com.myway.dto.flight.domain.TripType;
import com.myway.dto.order.domain.Inventory;

import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

//import com.hna.mars.service.extraproduct.dto.DTOServiceProduct;

/**
 * @类名称：DTOSegment 
 * @类描述：航段 
 * @创建时间：2015年11月11日 下午7:53:48 
 * @author Jiang.Yida
 * @version V1.0
 */
public class DTOSegment implements Serializable, Comparable<DTOSegment> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7781465850455548967L;
	private Long id;
	/**
	 * depCode:TODO 出发地
	 */
	private String depCode;
	/**
	 * depName: 出发地名称 
	 */
	private String depName;
	/**
	 * arrCode:TODO 目的地
	 */
	private String arrCode;
	/**
	 * arrName: 目的地名称 
	 */
	private String arrName;
	/**
	 * airlineCode:TODO 航空代码
	 */
	private String airlineCode;
	/**
	 * flightNo:TODO 航班号
	 */
	private String flightNo;
	/**
	 * cabinClass:TODO 舱位类型
	 */
	private String cabinClass;
	/**
	 * depTime:TODO 起飞时间
	 */
	private Date depTime;
	private Date depTimeforTQ;
	/**
	 * arrTime:TODO 抵达时间
	 */
	private Date arrTime;
	/**
	 * planeType:TODO 机型
	 */
	private String planeType;
	/**
	 * inventory:TODO 库存类型
	 */
	private Inventory inventory;
	
	//-------- not persist property...
	private String cabinState;
	
	private TripType tripType;
	
	/**
	 * 舱位价格。。。折扣前的价格。
	 */
	private double cabinPrice;
	
	/**
	 * 基础价
	 */
	private double baseFare;
	
	/**
	 * 积分
	 */
	private Integer point;
	
	/**
	 * 参考仓位
	 */
	private String referenceCabin ;
	
	/**
	 * 参考仓位价格
	 */
	private double referenceFare = 0;
	/**
	 * Time by when payment should be made before cancellation of the order with this segment
	 */
	private Date timeLimit;
	
	private String lowstCabin;
	
	//航段的辅营产品
//	private List<DTOServiceProduct> mealProductList  = new ArrayList<DTOServiceProduct>();
//	private List<DTOServiceProduct> yktProductList = new ArrayList<DTOServiceProduct>();
//	private List<DTOServiceProduct> luggageProductList = new ArrayList<DTOServiceProduct>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getDepCode() {
		return depCode;
	}

	public void setDepCode(String depCode) {
		this.depCode = depCode;
	}

	public String getArrCode() {
		return arrCode;
	}

	public void setArrCode(String arrCode) {
		this.arrCode = arrCode;
	}

	public String getAirlineCode() {
		return airlineCode;
	}

	public void setAirlineCode(String airlineCode) {
		this.airlineCode = airlineCode;
	}

	public String getFlightNo() {
		return flightNo;
	}

	public void setFlightNo(String flightNo) {
		this.flightNo = flightNo;
	}
	
	public String getCabinClass() {
		return cabinClass;
	}

	public void setCabinClass(String cabinClass) {
		this.cabinClass = cabinClass;
	}

	public Date getDepTime() {
		return depTime;
	}

	public Date getDepTimeforTQ() {
		return depTimeforTQ;
	}

	public void setDepTime(Date depTime) {
		this.depTime = depTime;
		if (depTime == null){
			this.depTimeforTQ = null;
		}else{
			SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
			String temp = formatter.format(depTime);
			try {
				this.depTimeforTQ = formatter.parse(temp);
			} catch (ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	public Date getArrTime() {
		return arrTime;
	}

	public void setArrTime(Date arrTime) {
		this.arrTime = arrTime;
	}

	public String getPlaneType() {
		return planeType;
	}

	public void setPlaneType(String planeType) {
		this.planeType = planeType;
	}

	public int compareTo(DTOSegment other) {
		return this.depTime.compareTo(other.depTime);
	}

	public Inventory getInventory() {
		return inventory;
	}

	public void setInventory(Inventory inventory) {
		this.inventory = inventory;
	}

	/**
	 * @return the cabinState
	 */
	public String getCabinState() {
		return this.cabinState;
	}

	/**
	 * @param cabinState the cabinState to set
	 */
	public void setCabinState(String cabinState) {
		this.cabinState = cabinState;
	}

	public TripType getTripType() {
		return tripType;
	}

	public void setTripType(TripType tripType) {
		this.tripType = tripType;
	}

	public Date getTimeLimit() {
		return timeLimit;
	}

	public void setTimeLimit(Date timeLimit) {
		this.timeLimit = timeLimit;
	}

	/**
	 * @return the cabinPrice
	 */
	public double getCabinPrice() {
		return this.cabinPrice;
	}

	/**
	 * @param cabinPrice the cabinPrice to set
	 */
	public void setCabinPrice(double cabinPrice) {
		this.cabinPrice = cabinPrice;
	}
	
	/**
	 * @return the point
	 */
	public Integer getPoint()
	{
		return point;
	}

	/**
	 * @param point the point to set
	 */
	public void setPoint(Integer point)
	{
		this.point = point;
	}

	public double getBaseFare() {
		return this.baseFare;
	}

	public void setBaseFare(double baseFare) {
		this.baseFare = baseFare;
	}

	public String getLowstCabin() {
		return lowstCabin;
	}

	public void setLowstCabin(String lowstCabin) {
		this.lowstCabin = lowstCabin;
	}

	public String getReferenceCabin() {
		return referenceCabin;
	}

	public void setReferenceCabin(String referenceCabin) {
		this.referenceCabin = referenceCabin;
	}

	public double getReferenceFare() {
		return referenceFare;
	}

	public void setReferenceFare(double referenceFare) {
		this.referenceFare = referenceFare;
	}

//	public List<DTOServiceProduct> getMealProductList() {
//		return mealProductList;
//	}
//
//	public void setMealProductList(List<DTOServiceProduct> mealProductList) {
//		this.mealProductList = mealProductList;
//	}
//
//	public List<DTOServiceProduct> getYktProductList() {
//		return yktProductList;
//	}
//
//	public void setYktProductList(List<DTOServiceProduct> yktProductList) {
//		this.yktProductList = yktProductList;
//	}
//
//	public List<DTOServiceProduct> getLuggageProductList() {
//		return luggageProductList;
//	}
//
//	public void setLuggageProductList(List<DTOServiceProduct> luggageProductList) {
//		this.luggageProductList = luggageProductList;
//	}

	@Override
	public String toString() {
		StringBuffer buf = new StringBuffer();
		buf.append("[").append(getId()).append("]")
			.append(getFlightNo())
			.append(" ")
			.append(getDepCode()).append("-").append(getArrCode())
			.append(" ")
			.append(getDepTime());
		return buf.toString();
	}

	public String getDepName() {
		return depName;
	}

	public void setDepName(String depName) {
		this.depName = depName;
	}

	public String getArrName() {
		return arrName;
	}

	public void setArrName(String arrName) {
		this.arrName = arrName;
	}	
	
}
